package com.ztgf.sys.api.client;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ztgf.common.constant.Result;
import com.ztgf.sys.models.dto.SysWebsiteSeoDTO;
import com.ztgf.sys.models.service.ISysWebsiteSeoService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 网站SEO控制器
 *
 * @author YUE
 * @Date 2020-07-09 11:22:10
 */

@RestController
@RequestMapping("/api/sysWebsiteSeo")
@Slf4j
@Api(value = "SysWebsiteSeoApiController",tags = "网站SEOAPi接口")
public class SysWebsiteSeoApiController {

    @DubboReference
    private ISysWebsiteSeoService sysWebsiteSeoService;

    /**
     * 获取网站seo
     * @return
     */
    @PostMapping("/get")
    public Result<SysWebsiteSeoDTO> get(){
        List<SysWebsiteSeoDTO> websiteSeoDTOList = sysWebsiteSeoService.selectList(new EntityWrapper<>());
        if(websiteSeoDTOList.size() <=0){
            return new Result<>();
        }
        return new Result<>(websiteSeoDTOList.get(0));
    }
}
